<template>
  <div class="divBox">
    <el-table
      v-loading="listLoading"

      size="small"
      :data="tableData.data"
      :header-cell-style=" {fontWeight:'bold'}"
    >
      <el-table-column
        prop="id"
        label="ID"
        min-width="50"
      />
      <el-table-column
        prop="uid"
        label="用户id"
        min-width="70"
        align="center"
      />
      <el-table-column
        prop="username"
        label="用户名"
        min-width="120"
        align="center"
      />
      <el-table-column
        prop="phone"
        label="手机号"
        min-width="100"
        align="center"
      />
      <el-table-column
        prop="orderId"
        label="订单号"
        min-width="100"
        align="center"
      />
      <el-table-column
        prop="latitude"
        label="纬度"
        min-width="120"
        align="center"
      />
      <el-table-column
        prop="longitude"
        label="经度"
        min-width="120"
        align="center"
      />
      <el-table-column
        label="签到时间"
        min-width="120"
        align="center"
      >
        <template slot-scope="scope">
          <span>{{ scope.row.signTime | dataFormat }}</span>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
        :page-sizes="[20, 40, 60, 80]"
        :page-size="tableFrom.limit"
        :current-page="tableFrom.page"
        layout="total, sizes, prev, pager, next, jumper"
        :total="tableData.total"
        @current-change="pageChange"
      />
    </div>
  </div>
</template>

<script>
import { activityLogListApi, locationListApi } from '@/api/activity'

export default {
  name: 'activityLog',
  props: {
    activityId: {
      type: Number
    }
  },
  data() {
    return {
      tableData: {
        data: [],
        total: 0
      },
      listLoading: false,
      tableFrom: {
        page: 1,
        limit: 20,
        activityId: 0
      }
    }
  },
  created() {
    console.info('活动id' + this.activityId)
    this.tableFrom.activityId = this.activityId
    this.getLogList()
  },
  mounted() {
    this.getLogList()
  },
  methods: {
    getLogList() {
      this.listLoading = true
      this.tableFrom.activityId = this.activityId
      activityLogListApi(this.tableFrom).then(res => {
        this.tableData.data = res.list
        this.tableData.total = res.total
        this.listLoading = false
      }).catch(res => {
        this.listLoading = false
        console.info(res)
        this.$message.error(res.message)
      })
    },
    pageChange(page) {
      this.tableFrom.page = page
      this.getLogList()
    },
  }
}
</script>

<style scoped>

</style>
